#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;

ll bt[10];
bool judge(ll num){
    if(num==0)return false;
    ll k=sqrt(num);
    if(k*k==num)return true;
    else return false;
}
bool judge_1(ll num){
    ll cnt=0;
    while(num){
        bt[cnt++]=num%10;
        num/=10;
    }
    ll sum1=0;
    for(ll i=cnt-1;i>0;i--){
        sum1=sum1*10+bt[i];
        if(judge(sum1)){
            ll sum2=0;
            for(ll j=i-1;j>=0;j--){
                sum2=sum2*10+bt[j];
            }
            if(judge(sum2))return true;
        }
    }
    return false;
}
int main()
{
    IOS;
    ll a,b;
    cin>>a>>b;
    ll i;
    if(judge(a)){
        i=sqrt(a);
    }
    else i=sqrt(a)+1;
    i=max((ll)4,i);
    ll ans=0;
    for(;i*i<=b;i++){
        if(judge_1(i*i)){
            cout<<i*i<<endl;
        }
    }
    // cout<<ans<<endl;
    getchar();
    getchar();
    return 0;
}
